#!/bin/bash

export PATH=$PATH:/apps/mamba/bin
export conda_path='/apps/mamba/24.3.0-0/bin'
source /apps/mamba/24.3.0-0/etc/profile.d/conda.sh

# ---------------------------------
echo "Step 1: Activate indeed_noc_python3 environment for data preparation"
mamba activate indeed_noc_python3

# Execute merging and pre-class scripts
jupyter nbconvert --to notebook --inplace --execute merge_duration.ipynb
python pre_class.py

# Copy English dictionaries
cp -r occupation_classification/dictionaries/dictionaries\ EN/* \
    /home/res/ceadeaa/condaenvs/occupationcoder/lib/python2.7/site-packages/occupationcoder/

# ---------------------------------
echo "Step 3: Activate occupationcoder environment for EN Classification"
mamba activate /home/res/ceadeaa/condaenvs/occupationcoder

# Execute English classification
jupyter nbconvert --to notebook --inplace --execute Classification_EN.ipynb

# ---------------------------------
echo "Step 4: Switch to BIL classification"

# Copy Bilingual dictionaries
cp -r occupation_classification/dictionaries/dictionaries\ BIL/* \
    /home/res/ceadeaa/condaenvs/occupationcoder/lib/python2.7/site-packages/occupationcoder/

# Run classification for Quebec and French postings using the Bilingual dictionaries
jupyter nbconvert --to notebook --inplace --execute Classification_BIL.ipynb

# ---------------------------------
echo "Step 5: Reactivate indeed_noc_python3 environment for final merge"
mamba activate indeed_noc_python3

# Run post-class notebook
jupyter nbconvert --to notebook --inplace --execute post_class_cleaned.ipynb

echo done